package org.dc.agent.configoper;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author 徐春鹏
 * @category 配置文件操作类
 * 
 * */

public class PropertiesUtil {

	/**
	 * 私有的构造方法，不可以创建本类的实例
	 */
	private PropertiesUtil() {
	}

	private static PropertiesUtil instance = new PropertiesUtil();

	public static PropertiesUtil getInstance() {
		return instance;
	}

	public Properties getPropertiesFromResource(String resourceName) {
		Properties properties = new Properties();
		InputStream inStream = null;
		try {
			inStream = getClass().getResourceAsStream(resourceName);
			properties.load(inStream);
			inStream.close();
		} catch (FileNotFoundException e1) {
			e1.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return properties;
	}

}
